package com.future.domain.vo;


import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

@Data
@AllArgsConstructor
@NoArgsConstructor

public class QuestionnaireResponseVOForT {
    private Long questionnaireId;
    private String title;
    private String description;
    private Integer totalNum;
    private Integer answeredNum;
    private Integer totalScore;
    private Integer averageScore;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime startAt;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime expiredAt;
    public double getAverageScore(){
        if(answeredNum == 0){
            return 0;
        }else{
            return (double) totalScore / answeredNum;
        }
    }
}
